/**
 * Created by albert on 2017/11/1.
 */
import {dateFormat} from '../util/methods'
const filters = {
    "idCardConfusion": (value) => {
        if(typeof(value)=='string') {
            let start = value.slice(0, 6);
            let end = value.slice(-6);
            return `${start}******${end}`;
        }
    },
    "unixTime": (unixtime, short = true) => {
        if (unixtime == '') return '';
        let unixTimestamp = new Date(unixtime * 1000)
        let formatter = short ? 'yyyy-MM-dd hh:mm:ss' : 'yyyy-MM-dd';
        return dateFormat(new Date(unixTimestamp), formatter)
    }
};
const registerFilters = (vue) => {
    for (var i in filters) {
        vue.filter(i, filters[i])
    }
}

export default registerFilters